<script>
export default {
  props: {
    inputsName: String,
    placeholder: String,
    disabled: [String, Boolean],
  },
  data() {
    return {
      timePick: null,
      start: '开始日期',
      end: '结束日期',
    }
  },
  created() {
    if (this.placeholder) {
      this.start = this.placeholder[0] || this.start
      this.end = this.placeholder[1] || this.end
    }
  },
}
</script>

<template lang="pug">
el-date-picker.picker(
  type="datetimerange"
  align="right"
  :unlink-panels="true"
  :name="inputsName"
  v-model="timePick"
  :disabled="disabled"
  value-format="yyyy-MM-dd"
  format="yyyy-MM-dd"
  range-separator="-"
  :start-placeholder="start"
  :end-placeholder="end"
  @change="$emit('getTime',timePick)"
)
</template>

<style lang="stylus"
.picker
  margin-right 8px
  width 350px
</style>